package com.core.controller.SeatReservation;


import com.core.pojo.Result.Result;
import com.core.service.SeatReservation.ReservationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("/classroom")
@Tag(name = "教室模块")
@RequiredArgsConstructor
public class ClassroomController {
    private final ReservationService reservationService;

    @Operation(summary = "单日单个教室可用座位数查询")
    @GetMapping("/available")
    public Result<Integer> getClassroomAvailableSeats( @RequestParam("roomId") Long classroomId,
                                                       @RequestParam("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date){
            return reservationService.getClassroomAvailableSeats(classroomId,date);
    }

}
